#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
class Solution
{
public:
    string convertToBase7(int num)
    {
        int n = abs(num);
        string ans = "";
        while (n != 0)
        {
            ans.append(to_string(n % 7));
            n = n / 7;
        }
        if (num < n)
            ans.append("-");
        else if (num == n)
            return "0";
        reverse(ans.begin(), ans.end());
        return ans;
    }
};
int main()
{
    Solution *s = new Solution();
    string ans = s->convertToBase7(-176);
    cout << ans << endl;
    return 0;
}